package com.boxin.ims.modules.wechat.utils;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Stack;

import com.boxin.ims.modules.wechat.entity.screen.BlessWords;
/**
 * @author Jakemanse
 * @date 2013-11-4
 * @function <p>大 屏幕祝福词</p>
 */
public class ScreenUtils {
	
	private static Map<Long,List<BlessWords> > blessMap = new HashMap<Long, List<BlessWords> >();
	
	
	/**
	 * @author Jakemanse
	 * @time 2013-11-4  下午12:04:45
	 * @function <p>  </p>
	 * @param blessWords
	 */
	public static void push(BlessWords blessWords){
		Long screenId = blessWords.getScreen().getId();
		List<BlessWords>  blessWordsList =	blessMap.get(screenId);
		
		if(blessWordsList == null || blessWordsList.isEmpty()){
			blessWordsList = new ArrayList<BlessWords>();
			blessWordsList.add(blessWords);
		}
		blessMap.put(screenId, blessWordsList);
	}
	
	/**
	 * @author Jakemanse
	 * @time 2013-11-4  上午11:46:04
	 * @function <p> 获得所有祝福词 </p>
	 * @return
	 */
	public static List<BlessWords> popAllByScreenId(Long screenId){
		List<BlessWords>  blessWordsList = new ArrayList<BlessWords>();
		List<BlessWords>  tempList = blessMap.get(screenId);
		
		if(tempList != null &&!tempList.isEmpty()){
			blessWordsList.addAll(blessMap.get(screenId));
			blessMap.remove(screenId);
		}
		
		return blessWordsList;
	}
	
	
	

}
